package com.jwgf.smarowindingmachine_unity.ui;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;

import com.jwgf.common.ViewCache;
import com.jwgf.smarowindingmachine_unity.R;

public class ProductionManagementMenuFragment extends MenuFragment implements OnClickListener{
	public static final String fragmentTag = "ProductionManagementMenuFragment";

	private Button changeclasssettingButton;
	private Button varietymanagementButton;
	private Button dutyreportButton;
	private Button statisticsreportButton;


	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View v = ViewCache.getInstance().getView(R.layout.fragment_production_management_menu);
//		View v = inflater.inflate(R.layout.fragment_production_management_menu,
//				container, false);
		changeclasssettingButton = (Button) v.findViewById(
				R.id.pm_productionset);
		changeclasssettingButton.setOnClickListener(this);
		changeclasssettingButton.setSelected(true);

		varietymanagementButton = (Button) v.findViewById(
				R.id.variety_management_button);
		varietymanagementButton.setOnClickListener(this);

		dutyreportButton = (Button) v.findViewById(
				R.id.pm_duty_reported);
		dutyreportButton.setOnClickListener(this);

		statisticsreportButton = (Button) v.findViewById(
				R.id.pm_statisticreport);
		statisticsreportButton.setOnClickListener(this);
		return v;
	}

	@Override
	public void switchSelection(int id) {
		if (id == R.id.pm_productionset) {
			changeclasssettingButton.setSelected(true);
			varietymanagementButton.setSelected(false);
			dutyreportButton.setSelected(false);
			statisticsreportButton.setSelected(false);
		} else if (id == R.id.variety_management_button) {
			changeclasssettingButton.setSelected(false);
			varietymanagementButton.setSelected(true);
			dutyreportButton.setSelected(false);
			statisticsreportButton.setSelected(false);
		} else if (id == R.id.pm_duty_reported) {
			changeclasssettingButton.setSelected(false);
			varietymanagementButton.setSelected(false);
			dutyreportButton.setSelected(true);
			statisticsreportButton.setSelected(false);
		} else if (id == R.id.pm_statisticreport) {
			changeclasssettingButton.setSelected(false);
			varietymanagementButton.setSelected(false);
			dutyreportButton.setSelected(false);
			statisticsreportButton.setSelected(true);
		}
	}


	@Override
	public void onClick(View v) {
		SwitchPageManager.getInstance().switchSecondMenu(getFragmentManager(), v.getId());
	}


}